/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.

 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.

 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

package com.nbplus.vnpy.common.msg;

import java.util.List;

/**
*表格数据返回
* Date: 2019/11/14
* Time: 11：00
* Version 1.0.0
* @Author gongtan
*/
public class TableResultResponse<T> extends BaseResponse {

   TableData<T> data;

   public TableResultResponse(long total, List<T> rows) {
       this.data = new TableData<T>(total, rows);
   }

   public TableResultResponse() {
       this.data = new TableData<T>();
   }

   TableResultResponse<T> total(int total) {
       this.data.setTotal(total);
       return this;
   }

   TableResultResponse<T> total(List<T> rows) {
       this.data.setRows(rows);
       return this;
   }

   public TableData<T> getData() {
       return data;
   }

   public void setData(TableData<T> data) {
       this.data = data;
   }

   public class TableData<T> {
       long total;
       List<T> rows;

       public TableData(long total, List<T> rows) {
           this.total = total;
           this.rows = rows;
       }

       public TableData() {
       }

       public long getTotal() {
           return total;
       }

       public void setTotal(long total) {
           this.total = total;
       }

       public List<T> getRows() {
           return rows;
       }

       public void setRows(List<T> rows) {
           this.rows = rows;
       }
   }
}
